package com.jzo2o.customer.controller.consumer;


import cn.hutool.core.bean.BeanUtil;
import com.jzo2o.customer.model.domain.BankAccount;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.request.WorkerCertificationAuditAddReqDTO;
import com.jzo2o.customer.service.IBankAccountService;
import com.jzo2o.customer.service.IWorkerCertificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController("BankAccountController")
@RequestMapping("/worker/bank-account")
@Api(tags = "服务人员认证信息")
public class BankAccountController {

    @Resource
    IBankAccountService bankAccountService;

    @PostMapping()
    @ApiOperation("新增或更新银行账号信息接口")
    public void addAndUpdateWorkerInfo(@RequestBody BankAccountUpsertReqDTO bankAccountUpsertReqDTO){

        BankAccount bankAccount = BeanUtil.toBean(bankAccountUpsertReqDTO, BankAccount.class);

        bankAccountService.saveOrUpdate(bankAccount);

    }

    @GetMapping("/currentUserBankAccount")
    public BankAccount currentUserBankAccount(){

        return bankAccountService.currentUserBankAccount();

    }


}
